<template>
	<view class="ucenter" :class="lang">
		<view class="ucenter-header">
			<view class="ucenter-title">
				{{ $t('ucenters.个人中心') }}
			</view>
			<!-- 个人信息 -->
			<view class="ucenter-message">
				<view class="message-top">
					<view class="message-avatar">
						<image class="avatar-img" :src="pic"></image>
					</view>
					<view class="message">
						<view class="nickName">
							{{uinfo.nick_name?uinfo.nick_name : $t('ucenters.微信客户')}}
						</view>
						<view class="uid">
							{{$t('ucenters.UID')}}{{uinfo.uid}}
						</view>
					</view>
					<view v-if="novip == 0" class="ljkt" @click="openvips()">
						{{$t('ucenters.立即开通')}}
					</view>
					<view v-if="novip == 1">
						<view v-if="lang =='cn'" class="vip-content vip-content-putong">
							<text class="whitetxt">{{ $t('ucenters.普通会员') }}:</text>
							<text class="whitetxt">{{uinfo.jieshuriqi | formatDate}}</text>
							<text class="whitetxt">{{ $t('ucenters.到期') }}</text>
						</view>

						<view v-else class="vip-content vip-content-putong">
							<text class="whitetxt">{{ $t('ucenters.普通会员') }}:</text>
							<text class="whitetxt">{{ $t('ucenters.到期') }}</text>
							<text class="whitetxt">{{uinfo.jieshuriqi | formatDate}}</text>
						</view>

					</view>
					<view v-if="novip == 2">

						<view v-if="lang =='cn'" class="vip-content vip-content-putong">
							<text class="whitetxt">{{ $t('ucenters.超级会员') }}:</text>
							<text class="whitetxt">{{uinfo.jieshuriqi | formatDate}}</text>
							<text class="whitetxt">{{ $t('ucenters.到期') }}</text>
						</view>

						<view v-else class="vip-content vip-content-putong">
							<text class="whitetxt">{{ $t('ucenters.超级会员') }}:</text>
							<text class="whitetxt">{{ $t('ucenters.到期') }}</text>
							<text class="whitetxt">{{uinfo.jieshuriqi | formatDate}}</text>
						</view>

					</view>
				</view>
				<view class="ucenter-qiehuan">
					<view class="kemu">
						<view v-if="lang == 'cn'" class="kemuone">
							{{$t('ucenters.科一')}}
						</view>
						<view v-else class="kemuone" style="direction: rtl;">
							{{$t('ucenters.科一')}}
						</view>
						<view v-if="lang == 'cn'" class="kemufour">
							{{$t('ucenters.科四')}}
						</view>
						<view v-else class="kemufour" style="direction: rtl;">
							{{$t('ucenters.科四')}}
						</view>
					</view>
					<view class="carttype">
						<view class="type-text" @click="linkSetting">{{$t('ucenters.切换题库')}}</view>
						<view class="cartname" @click="linkSetting">{{carttypename}}</view>
						<view class="" @click="linkSetting">
							<image class="qiehuan-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/right.png">
							</image>
						</view>

					</view>
				</view>
			</view>


		</view>
		<!-- 会员 -->
		<view v-if="novip == 0" class="ucenter-vip">
			<image class="vip-img"
				src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/ucenterbanner.png"></image>
			<view class="vip-content" @click="openvips()">
				{{$t('ucenters.立即开通')}}
			</view>
		</view>

		<view v-if="novip == 1" class="ucenter-vip ">
			<image class="vip-img"
				src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/ucenterbanner.png"></image>
			<view v-if="lang=='cn'" class="vip-content vip-content-putong">
				<text class="whitetxt">{{ $t('ucenters.普通会员') }}:</text>
				{{uinfo.jieshuriqi | formatDate}}
				<text class="whitetxt">{{ $t('ucenters.到期') }}</text>
			</view>
			<view v-else class="vip-content vip-content-putong">
				<text class="whitetxt">{{ $t('ucenters.普通会员') }}:</text>
				<text class="whitetxt">{{ $t('ucenters.到期') }}</text>
				{{uinfo.jieshuriqi | formatDate}}
			</view>

		</view>
		<view v-if="novip == 2" class="ucenter-vip ">
			<image class="vip-img"
				src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/ucenterbanner.png"></image>
			<view v-if="lang == 'cn'" class="vip-content vip-content-putong">
				<text class="whitetxt">{{ $t('ucenters.超级会员') }}:</text>
				{{uinfo.jieshuriqi | formatDate}}
				<text class="whitetxt">{{ $t('ucenters.到期') }}</text>
			</view>
			<view v-else class="vip-content vip-content-putong">
				<text class="whitetxt">{{ $t('ucenters.超级会员') }}:</text>
				{{uinfo.jieshuriqi | formatDate}}
				<text class="whitetxt">{{ $t('ucenters.到期') }}</text>
			</view>
		</view>
		<view v-if="novip == 3" class="ucenter-vip ">
			<image class="vip-img"
				src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/txybanner.png"></image>
			<view class=" vip-txy">
				<image class="minivip-img"
					src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/vipbg.png"></image>
				<view class="vip-txy-text">
					{{ $t('ucenters.代理商') }} V1
				</view>
			</view>
			<view class="vip-cart">
				<view class="cart-gl">
					{{ $t('ucenters.卡密管理') }}
				</view>
				<view class="cart-class-gl">
					<view class="cart-class-gl-pt" @click="gotocart(1)">
						<view class="num">
							{{ptknum}}<text> {{ $t('shopcarts.张卡')}}</text>
						</view>
						<view class="text">
							{{ $t('usercenter.季卡')}}
						</view>
					</view>
					<view class="cart-class-gl-pt" @click="gotocart(2)">
						<view class="num">
							{{cjknum}}<text> {{ $t('shopcarts.张卡')}}</text>
						</view>
						<view class="text">
							{{ $t('usercenter.永久卡')}}
						</view>
					</view>
				</view>
			</view>
		</view>


		<!-- 分享 购卡 -->
		<view class="share-shop">
			<view class="share-box box" @click="showMenu()">
				<image class="vip-img"
					src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/share.png"></image>
				<image class="go-img"
					src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/goshare.png"></image>
				<!-- #ifdef MP-WEIXIN -->
				<u-button id="shareBtn" open-type="share" :custom-style="custom_button" :hair-line="true"></u-button>
				<!-- #endif -->
			</view>

			<view class="shop-box box" @click="link('/ucenter/shopcart')">
				<image class="vip-img "
					src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/shop.png"></image>
				<image class="go-img"
					src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/goshop.png"></image>
			</view>

		</view>



		<!-- 其他工具 -->
		<view class="ucenter-tool">
			<view class="ucenter-tooltitle">
				<image class="ucenter-tooltitle-img"
					src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/qita.png"></image>
			</view>
			<view class="toollist">
				<view class="toollist-item" @click="link('/school/school')">
					<image class="toollist-item-img"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/bm.png"></image>
					<view class="toollist-item-text">
						{{$t('ucenters.驾校报名')}}
					</view>
					<image class="toollist-item-imgright"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/right.png"></image>
				</view>
				<view class="toollist-item" @click="link('/ucenter/setting')">
					<!-- <view class="toollist-item" @click="linkssss"> -->
					<image class="toollist-item-img"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/pt.png"></image>
					<view class="toollist-item-text">
						{{$t('ucenters.更多设置')}}
					</view>
					<image class="toollist-item-imgright"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/right.png"></image>
				</view>
				<view class="toollist-item" @click="link('/ucenter/about')">
					<image class="toollist-item-img"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/wm.png"></image>
					<view class="toollist-item-text">
						{{$t('ucenters.关于我们')}}
					</view>
					<image class="toollist-item-imgright"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/right.png"></image>
				</view>
				<view class="toollist-item" @click="kefulink">
					<image class="toollist-item-img"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/kf.png"></image>
					<view class="toollist-item-text">
						{{$t('ucenters.联系客服')}}
					</view>
					<image class="toollist-item-imgright"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/right.png"></image>
				</view>
				<view class="toollist-item" @click="loginoutzx">
					<image class="toollist-item-img"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/zx.png"></image>
					<view class="toollist-item-text">
						{{$t('ucenters.注销账号')}}
					</view>
					<image class="toollist-item-imgright"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/right.png"></image>
				</view>
				<view class="toollist-item" @click="loginout">
					<image class="toollist-item-img"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/tc.png"></image>
					<view class="toollist-item-text">
						{{$t('ucenters.退出登录')}}
					</view>
					<image class="toollist-item-imgright"
						src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/right.png"></image>
				</view>

			</view>

		</view>

		<view class="xieyi">
			<text @click="openweb('user')">{{$t('ucenters.服务协议')}}</text><text class="shu"></text>
			<text @click="openweb('privacy')">{{$t('ucenters.隐私政策')}}</text>
		</view>

		<paybox :show="show"></paybox>
		<u-tabbar v-model="tabcurrent" :list="tabbarlist" :mid-button="false" active-color="#0895FB"
			:before-switch="beforeSwitch"></u-tabbar>
		<!-- ------------ -->
		<!-- <view class="" style="height: 200rpx "></view> -->
	</view>

</template>

<script>
	//分享
	// #ifdef APP-PLUS
	import BottomImageMenu from '@/components/zh-bottom-image-menu/zh-bottom-image-menu.js'
	var bottomImageMenu = null
	// #endif
	//#ifdef APP-PLUS
	import {
		isOpen,
		openDb,
		addTab,
		mergeSql,
		getDataList,
		addTabItem,
		closeSQL,
		deleteInformationType,
		getTable,
		getCount,
		updateSQL,
		isTable,
		selectDataList
	} from '@/js_sdk/lyz-sqlite/index.js';
	//#endif
	//接口
	import {
		about_api, //关于我们
		updpk_api,
		cartlist_api, //卡号卡密列表
		isShow_api
	} from '@/api/index';

	import paybox from '@/components/paybox/paybox.vue'
	import {
		getCarType,
		getArrEqual,
		getArrload,
		kemuname
	} from '../../common/savetool.js';
	export default {
		computed: {
			menus() {
				return [{
						icon: '/static/sharemenu/wechatfriend.png',
						label: '微信好友'
					},
					{
						icon: '/static/sharemenu/wechatmoments.png',
						label: '朋友圈'
					},
					{
						icon: '/static/sharemenu/copyurl.png',
						label: '复制链接'
					}
				]
			}
		},

		components: {
			paybox //支付模块
		},
		data() {

			return {
				custom_button: {
					// 'transform': 'translate(0px,-100rpx) !important',
					// 'backgroundColor': 'transparent !important',
					// 'border': 'none !important',
					'backgroundColor': '#000000 !important',
					'zIndex': '99999 !important',
					'height': '200rpx !important'
				},
				lang: this.$i18n.locale,
				pic: '../../static/logo.png',
				localinfo: {}, //本地信息
				//tabbar
				tabbarlist: [{
						text: this.$t('indexs.首页'),
						iconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon1.png",
						selectedIconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon1ed.png",
						customIcon: false,
					},
					{
						text: this.$t('indexs.我的'),
						iconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon2.png",
						selectedIconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon2ed.png",
						customIcon: false,
					}
				],
				tabcurrent: 1,
				show: false,
				//选择季卡超级卡
				seasoncart: false,
				vipcart: false,
				paytypebutton: false,
				buttontext: this.$t('ucenters.选择卡类型'),
				paytypetext: 'null',
				paytypetotal: false, //支付类型未选择
				carttypetotal: false, //卡类型未选择
				closeable: true,
				closeIconPos: 'top-right',
				//vip开关
				novip: 0,
				attrlangshow: false, //是否切换题库弹出框开关
				qiutshow: false, //是否退出
				carttitlecon: this.$t('usercenter.普通卡介绍'),
				cartcontent: this.$t('usercenter.普通卡介绍内容'),
				carttypename: '',
				kemunames: '',
				langname: '',
				uinfo: {},
				logins: false,
				kalistnum: 0,
				shenhe: false,
				fanpage: 'index',
				ptknum: 0,
				cjknum: 0,
				kftel: null,
				isShow: null
			};
		},
		onBackPress(options) {
			var that = this;
			console.log("点击返回事件")
			closeSQL().then(res => {
				console.log(res)
			})
			//#ifdef APP-PLUS
			if (uni.getSystemInfoSync().platform == 'ios') {
				plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
			} else if (uni.getSystemInfoSync().platform == 'android') {
				console.log("andriod exit")
				plus.runtime.quit();
			}
			//#endif

			if (options.from === 'navigateBack') {
				return false;
			}
			this.backcenter();
			return true;
		},

		onLoad(options) {
			this.tekserws()
			var that = this;
			console.log("options", options);

			try {
				const value = uni.getStorageSync('lang_key');
				//console.log("app onlaunch",value);
				if (value) {
					that.$i18n.locale = value;
					that.lang = value;
					if (value == 'cn') {
						that.lolang = 'CN';
					}
					if (value == 'uy') {
						that.lolang = 'UG';
					}
					if (value == 'kz') {
						that.lolang = 'KAZ';
					}
				} else {
					uni.reLaunch({
						url: 'pages/setting/setting'
					});
				}
			} catch (e) {
				// error
				uni.reLaunch({
					url: 'pages/setting/setting'
				});
			}

			var typeterminals = that.$kterminal;
			if (typeterminals == 'android') {
				that.shenhe = true;
			} else {
				var jshenhe = uni.getStorageSync('jshenhe');
				if (jshenhe) {
					that.shenhe = false;
				} else {
					that.shenhe = true;
				}

			}

			// bottomImageMenu = new BottomImageMenu(menus);
			that.fanpage = options.page;
			//获取设置数据
			uni.getStorage({
				key: 'cart_type',
				success: function(res) {
					console.log('rrrrrrrrrrrrrr', res);
					// that.carttypename = that.$t('settings.' + res.data);
					that.carttypename = res.data
				}
			});
			//获取科目
			uni.getStorage({
				key: 'kemu_type',
				success: function(res) {
					console.log(res);
					if (that.fanpage == 'index') {
						that.kemunames = that.$t('settings.' + kemuname(res.data));
					}

					console.log(kemuname(res.data))
				},
				fail() {
					that.$u.route({
						url: 'pages/setting/setting',
						params: {}
					});
				}
			});
			uni.getStorage({
				key: 'lang_key',
				success: function(res) {
					console.log(res.data);
					that.$i18n.locale = res.data;
					that.langname = that.$t(res.data);

				},
				fail() {}
			});
			//获取用户信息
			uni.getStorage({
				key: 'user_infos',
				success: function(res) {
					console.log("3333333333333", res.data);
					var uinfos = res.data;
					that.uinfo = uinfos;
					that.logins = true;
					// #ifdef MP-WEIXIN
					that.pic = '../../static/logo.png';
					// #endif
					console.log("uinfos.pic_url", that.uinfo.jieshuriqi);
					//#ifdef APP-PLUS
					if (uinfos.pic_url == undefined || uinfos.pic_url == '') {
						that.pic = '../../static/logo.png';
					} else {
						that.pic = uinfos.pic_url;
					}
					// #endif


					//判断用户级别
					var userstatus = uinfos.userstatus;
					// userstatus -- -3其他情况 -2到期 -1禁用 0-不是会员 1-普通会员 2-高级会员 3代理
					if (userstatus < 1) {
						that.novip = 0; //没有开通会员
					}
					if (userstatus == 1) {
						that.novip = 1;
					}
					if (userstatus == 2) {
						console.log("我的页面wwwwwwwwwwww判断状态")
						that.novip = 2;
					}
					if (userstatus == 3) {
						that.novip = 3;
					}
					//模拟
					// that.novip = 3;
				},
				fail() {}
			});
			that.abinit();
			//演示使用
			if (options.novip != undefined) {
				that.novip = options.novip;
				if (options.showf == 'false') {
					that.show = false;
				} else {
					that.show = true;
				}
				if (options.langshow == 'false') {
					that.attrlangshow = false;
				} else {
					that.attrlangshow = true;
				}
			}
			if (options.qiut == 'true') {
				that.qiutshow = true;
			}
			that.banben();
		},
		onShareAppMessage(res) {
			return {
				title: this.$t('分享文字'),
				path: '/pages/index/start'
			}
		},
		// 自定义页面的分享到朋友圈
		onShareTimeline(res) {
			return {
				title: this.$t('分享文字'),
				path: '/pages/index/start'

			}
		},
		onShow() {
			this.handleShow()
		},
		methods: {
			handleShow() {
				this.http({
					url: isShow_api,
					method: 'GET',
					header: {
						'content-type': 'application/json'
					},
					data: {},
					success: res => {
						console.log("模块显隐", res)
						this.isShow = res.isShow
					},
					fail: err => {
						console.log(err);
					}

				});
			},
			linkssss() {
				uni.reLaunch({
					url: './adddata'
				})
			},
			tekserws: function() {

				var that = this;

				//获取客服手机号接口
				// that.kftel = 15688353919;
				var typeterminals = that.$kterminal;
				console.log("typeterminals----=", typeterminals)
				if (typeterminals == 'android') {
					that.jshenhe = false;
					uni.setStorageSync('jshenhe', false);
				} else {
					that.jshenhe = true;
					// uni.setStorageSync('jshenhe', jvalue);
				}
				that.http({
					url: "jia.json",
					method: 'GET',
					header: {
						// 'content-type': 'application/x-www-form-urlencoded'
						'content-type': 'application/json'
					},
					data: {},
					success: resmm => {
						console.log(resmm);
						// that.teks = resmm.tekserw;
						//that.jshenhe = resmm.fasker;

						var jvalue = resmm.fasker

						var typeterminals = that.$kterminal;
						console.log("typeterminals----=", typeterminals)
						if (typeterminals == 'android') {
							that.jshenhe = false;
							uni.setStorageSync('jshenhe', false);
						} else {
							that.jshenhe = jvalue;
							uni.setStorageSync('jshenhe', jvalue);
						}

						//that.jshenhe = true;
						that.kftel = resmm.kefu;



					},
					fail: err => {
						console.log(err);
					}

				});
			},
			kefulink() {
				var that = this;
				// console.log("联系客服",that.kfte)
				uni.makePhoneCall({
					phoneNumber: that.kftel
				});
			},
			gotocart(type) {
				uni.navigateTo({
					// url: '../ucenter/cart'
					url: `../ucenter/cart?type=${type}`
				});
			},
			loginoutzx: function() {
				var that = this;
				uni.showModal({
					title: '提示',
					content: '需要审核48小时',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.clearStorageSync();
							uni.reLaunch({
								url: '../index/start'
							})

						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
			openweb: function(link) {
				var that = this;
				if (link == 'user') {
					uni.navigateTo({
						url: '../template/user'
					});
				} else {
					uni.navigateTo({
						url: '../template/index'
					});
				}

			},
			banben() {
				var that = this;
				that.https({
					url: updpk_api,
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					data: {},
					success: res => {
						console.log(res);
						let versi = uni.getStorageSync('jshenhe');
						console.log('versi=', versi);
						// if (versi == true) {
						var typeterminals = that.$kterminal;
						if (typeterminals == 'android') {
							that.shenhe = true;
						} else {
							//if(versi == )
							var jshenhe = uni.getStorageSync('jshenhe');
							if (jshenhe) {
								that.shenhe = false;
							} else {
								that.shenhe = true;
							}
						}
						// }else{
						// 	that.shenhe = true;
						// }

					},
					fail: err => {
						console.log(err);
					}
				});
			},
			backcenter() {
				return false;
			},
			showMenu() {
				var that = this;
				// console.log("bottomImageMenu",that.bottomImageMenu)
				// #ifdef APP-PLUS
				console.log("bottomImageMenu", bottomImageMenu)
				if (!bottomImageMenu) {
					bottomImageMenu = new BottomImageMenu(that.menus, (menu, index) => {
						that.fenxiang(index);
						//uni.showToast({ title: `点击了:${menu.label},索引是${index},这是统一处理的`, icon: 'none' })
					})
				}
				bottomImageMenu.show();
				// #endif
				// #ifdef MP-WEIXIN
				uni.showShareMenu();
				// console.log("分享好友")
				// #endif
			},


			loginout: function() {
				var that = this;
				uni.showModal({
					title: '提示',
					content: '确定退出吗？',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.clearStorageSync();
							uni.reLaunch({
								url: '../index/start'
							})

						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},

			link: function(links) {
				var that = this;

				this.$u.route({
					url: '/pages' + links,
				})
			},
			linkSetting() {
				uni.redirectTo({
					url: "../setting/setting"
				})
			},
			openvips: function() {
				var that = this;
				that.show = true;
			},
			//弹出框
			radioChange: function(evt) {
				var that = this;
				console.log("evt");
				console.log(evt);
				var that = this;
				that.paytypebutton = true;
				that.paytypetotal = true;
				that.paytypetext = evt;
				that.paytext();
				// for (let i = 0; i < this.items.length; i++) {
				//     if (this.items[i].value === evt.detail.value) {
				//         this.current = i;
				//         break;
				//     }
				// }
			},
			cartclick(num) {
				var that = this;
				if (num == 0) {
					that.seasoncart = true;
					that.vipcart = false;
					that.carttitlecon = that.$t('usercenter.普通卡介绍');
					that.cartcontent = that.$t('usercenter.普通卡介绍内容');
				}
				if (num == 1) {
					that.seasoncart = false;
					that.vipcart = true;
					that.carttitlecon = that.$t('usercenter.超级卡介绍');
					that.cartcontent = that.$t('usercenter.超级卡介绍内容');
				}
				that.carttypetotal = true;
				that.paytext();
			},
			paytext() {
				var that = this;
				console.log("paytext=", that.paytypetext)
				if (that.paytypetotal == false) {

					that.buttontext = this.$t('ucenters.选择支付方式');
					return false;
				} else if (that.carttypetotal == false) {
					that.buttontext = this.$t('ucenters.选择卡类型');
					return false;
				} else {
					that.buttontext = this.$t('ucenters.支付');
				}



				// if (that.paytypetext !== 'null' || (that.seasoncart == true && that.vipcart == true)) {
				// 	that.buttontext = this.$t('ucenters.支付');
				// } else if (that.paytypetext == 'null') {
				// 	that.buttontext = this.$t('ucenters.选择支付方式');
				// } else {
				// 	that.buttontext = this.$t('ucenters.选择卡类型');
				// }
			},
			beforeSwitch(index) {
				var that = this;
				console.log(index, 'index');
				console.log(index, 'index');


				try {
					const value = uni.getStorageSync('exam_type');
					if (value) {
						if (index == 0) {
							if (value == 'zigezheng') {
								console.log('tiao zhuan le ');
								uni.redirectTo({
									url: '../index/qualification'
								});
							} else {
								uni.redirectTo({
									url: '../index/index'
								});
							}

						}
					}
				} catch (e) {
					// error
				}


				if (index == 1) {
					return false;
				}

			},
			fenxiang(num) {
				console.log(this.$url);
				console.log("num", num);
				var that = this;
				if (num == 0) {
					//#ifdef APP-PLUS
					uni.share({
						provider: "weixin",
						scene: "WXSceneSession",
						title: that.$t('分享文字'),
						imageUrl: "../../static/logo.png",
						href: "https://www.tongyongjiakao.com",
						type: 0,
						summary: that.$t('分享描述'),
						success: function(res) {
							console.log("success:" + JSON.stringify(res));
						},
						fail: function(err) {
							console.log("fail:" + JSON.stringify(err));
						}
					});
					//#endif
				}
				if (num == 1) {
					//#ifdef APP-PLUS
					uni.share({
						provider: "weixin",
						scene: "WXSceneTimeline",
						title: that.$t('分享文字'),
						imageUrl: "../../static/logo.png",
						href: "https://www.tongyongjiakao.com",
						type: 0,
						summary: that.$t('分享描述'),
						success: function(res) {
							console.log("success:" + JSON.stringify(res));
						},
						fail: function(err) {
							console.log("fail:" + JSON.stringify(err));
						}
					});
					//#endif
				}
				if (num == 2) {
					//复制链接
					var value = '通用驾考下载地址：https://www.tongyongjiakao.com'
					uni.setClipboardData({
						data: value, //要被复制的内容
						success: () => { //复制成功的回调函数
							uni.showToast({ //提示
								title: '复制成功'
							})
						}
					});

				}


			},
			abinit() {
				var that = this;
				//判断网络状态
				uni.getNetworkType({
					success: res => {
						console.log("network--=", res);
						if (res.networkType == 'none') {
							//this.isConnected = false;  没有网络
							// #ifdef APP-PLUS
							//打开本地数据库
							if (isOpen('data')) {
								//数据库已打开
								console.log('数据库已打开');
								that.liteabout(); //获取离线信息
							} else {
								//数据库没有打开  先打开
								console.log('数据库未打开');
								that.openDb();
							}

							// #endif
						} else {
							//this.isConnected = true;   有网络
							that.aboutdata();
							that.kanum();
						}
					}
				});
			},
			kanum() {
				var that = this;
				//var type = 0
				that.https({
					url: cartlist_api,
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					data: {},
					success: res => {
						//console.log(res);
						that.kalistnum = res.card_list.length; //卡全部数量
						//that.kalist = res.card_list;//全部
						for (let i = 0; i < res.card_list.length; i++) {
							if (res.card_list[i].kleixing == 0) {
								that.ptknum += 1
							} else {
								that.cjknum += 1
							}
						}


					},
					fail: err => {
						console.log(err);
					}
				});
			},
			//打开数据库
			openDb() {
				var that = this;
				if (isOpen('data')) return;
				openDb('data').then(res => {
					console.log(res);
					that.liteabout();
				});
			},
			liteabout: function() {
				var that = this;

				//读取本地数据
				var sql = "SELECT *  FROM about  WHERE id = 1;";
				// var danxuan = "";
				// var panduan = "";
				// var duoxuan = "";
				plus.sqlite.selectSql({
					name: 'data',
					sql: sql,
					success(est) {
						console.log("sssssssssssssss", est.length);
						console.log(sql);
						console.log(est);
						//that.apinfo = est;
						that.localinfo = est[0];
						console.log("est[0]", est[0])
					},
					fail(err) {
						console.log(err);

					}
				});
			},
			aboutdata: function() {
				var that = this;
				that.https({
					url: about_api,
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					data: {},
					success: res => {
						console.log(res);
						//修改本地数据
						//#ifdef APP-PLUS
						updateSQL('data', 'about', res, 'id', '1').then(res => {
							console.log('1111');
							console.log("db res", res);

						})
						// #endif
						that.localinfo = res;
					},
					fail: err => {
						console.log(err);
					}
				});
			}

		},
		filters: {
			formatDate: function(value) {
				console.log(value);
				var ms = Number(value);
				var date = new Date(ms);
				//date.setTime(value);
				var month = date.getMonth() + 1;
				var hours = date.getHours();
				if (hours < 10)
					hours = "0" + hours;
				var minutes = date.getMinutes();
				if (minutes < 10)
					minutes = "0" + minutes;
				//var time = month + "-" + date.getDate() +
				" " + hours + ":" + minutes;
				var time = date.getFullYear() + "." + month + "." + date.getDate();
				return time;
			},
			formatDates: function(value) {
				console.log(value);
				var ms = Number(value);
				var date = new Date(ms);
				//date.setTime(value);
				var month = date.getMonth() + 1;
				var hours = date.getHours();
				if (hours < 10)
					hours = "0" + hours;
				var minutes = date.getMinutes();
				if (minutes < 10)
					minutes = "0" + minutes;
				//var time = month + "-" + date.getDate() +
				" " + hours + ":" + minutes;
				var time = date.getFullYear() + "." + month + "." + date.getDate()
				//     " " + hours + ":" + minutes;
				return time;
			}

		}
	};
</script>

<style scoped lang="scss">
	.shears {
		position: relative;
	}

	#shareBtn {
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
		opacity: 0;
	}


	.ucenter {
		min-height: 100%;
		background-color: #F7F7F7;

		.ucenter-header {
			width: 750rpx;
			background: linear-gradient(180deg, #0DA0FF 0%, rgba(13, 160, 255, 0) 100%);
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			opacity: 1;
			padding-top: 100rpx;
			padding-left: 30rpx;
			box-sizing: border-box;

			.ucenter-title {
				width: 100%;
				text-align: center;
				font-size: 36rpx;
				// font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #FFFFFF;
				line-height: 42rpx;
			}

			.ucenter-message {
				width: 690rpx;
				height: 238rpx;
				background: #FFFFFF;
				box-shadow: 2rpx 2rpx 9rpx 0rpx #CEDAE3;
				border-radius: 20rpx 20rpx 20rpx 20rpx;
				opacity: 1;
				margin-top: 50rpx;
				padding: 20rpx 30rpx;

				.message-top {
					display: flex;
					position: relative;

					.vip-content {
						// width: 138rpx;
						height: 48rpx;
						background: #9A5838;
						border-radius: 61rpx 61rpx 61rpx 61rpx;
						position: absolute;
						top: 21rpx;
						right: -20rpx;
						font-size: 24rpx;
						// font-family: PingFang SC-Medium, PingFang SC;
						font-weight: 500;
						color: #FFFFFF;
						text-align: center;
						line-height: 48rpx;
						padding: 0 10rpx;
						padding-top: 3rpx;
					}

					.message-avatar {
						width: 112rpx;
						height: 112rpx;

						.avatar-img {
							width: 100%;
							height: 100%;
							border-radius: 60rpx;
						}
					}

					.message {
						height: 112rpx;
						margin-left: 14rpx;
						// padding-top:24rpx ;
						margin-left: 10rpx;
						box-sizing: border-box;

						.nickName {
							width: 150rpx;
							// background-color: pink;
							margin-top: 20rpx;
							width: 186rpx;
							height: 39rpx;
							font-size: 28rpx;
							font-family: PingFang SC-Medium, PingFang SC;
							font-weight: 500;
							color: #2B2B2B;
							line-height: 33rpx;
							white-space: nowrap;
							overflow: hidden;
							text-overflow: ellipsis;
						}

						.uid {
							width: 122rpx;
							height: 34rpx;
							font-size: 24rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #AAAAAA;
							line-height: 28rpx;
						}
					}

					.ljkt {
						margin-top: 20rpx;
						// width: 107rpx;
						height: 40rpx;
						background: linear-gradient(90deg, #FFDEAC 0%, #F5C781 100%);
						border-radius: 33rpx 33rpx 33rpx 33rpx;
						opacity: 1;
						font-size: 20rpx;
						// font-family: PingFang SC-Bold, PingFang SC;
						font-weight: bold;
						color: #333333;
						line-height: 40rpx;
						text-align: center;
						padding: 0 10rpx;
						box-sizing: border-box;
					}
				}

			}

			.ucenter-qiehuan {
				width: 100%;
				margin-top: 34rpx;
				display: flex;
				justify-content: space-between;

				.kemu {
					// width: 171rpx;
					height: 42rpx;
					border-radius: 21rpx;
					border: 1px solid #0DA0FF;
					font-size: 24rpx;
					// font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					line-height: 41rpx;
					text-align: center;
					display: flex;

					.kemuone {
						// width: 93rpx;
						height: 41rpx;
						background-color: #0DA0FF;
						border-radius: 21rpx;
						color: #FFFFFF;
						padding: 0 10rpx;
						box-sizing: border-box;
						margin-left: -5rpx;
					}

					.kemufour {
						// width: 93rpx;
						height: 41rpx;
						border-radius: 21rpx;
						color: #0DA0FF;
						padding: 0 10rpx;
						box-sizing: border-box;
					}
				}

				.carttype {
					display: flex;
					align-items: center;

					.type-text {
						font-size: 24rpx;
						// font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #2B2B2B;
						line-height: 28rpx;
					}

					.cartname {
						font-size: 24rpx;
						// font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #0DA0FF;
						line-height: 28rpx;
						margin: 0 20rpx;
					}

					.qiehuan-img {
						width: 9rpx;
						height: 18rpx;
					}

				}
			}


		}

		.ucenter-vip {
			margin-top: 30rpx;
			width: 100%;
			padding-left: 30rpx;
			box-sizing: border-box;
			position: relative;

			.vip-img {
				width: 690rpx;
				height: 229rpx;
				// position: absolute;
			}

			.vip-content {
				// width: 138rpx;
				height: 48rpx;
				background: #9A5838;
				border-radius: 61rpx 61rpx 61rpx 61rpx;
				position: absolute;
				top: 21rpx;
				right: 40rpx;
				font-size: 24rpx;
				// font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				text-align: center;
				line-height: 48rpx;
				padding: 0 10rpx;
				padding-top: 3rpx;
			}

			.vip-content-putong {
				// width: 330rpx;
				height: 48rpx;
				position: absolute;
				right: 40rpx;
				top: 0rpx;
			}

			.vip-txy {
				position: absolute;
				top: 161rpx;
				left: 37rpx;
				display: flex;
				align-items: center;

				.minivip-img {
					width: 39.02rpx;
					height: 19.23rpx;
					margin-left: 30rpx;
					margin-right: 10rpx;
				}

				.vip-txy-text {
					font-size: 28rpx;
					// font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #EFEFEF;
					line-height: 33rpx;
				}
			}

			.vip-cart {
				width: 422rpx;
				height: 168rpx;
				position: absolute;
				top: 28rpx;
				right: 57rpx;

				.cart-gl {
					// width: 144rpx;
					height: 37rpx;
					background: linear-gradient(144deg, #FFDDA9 0%, #CFA157 100%);
					box-shadow: inset 1rpx 1rpx 3rpx 0rpx rgba(255, 255, 255, 0.5);
					border-radius: 19rpx 19rpx 19rpx 19rpx;
					opacity: 1;
					font-size: 26rpx;
					// font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #2E2E30;
					line-height: 37rpx;
					position: absolute;
					top: -17rpx;
					left: 150rpx;
					text-align: center;
					padding: 2rpx 10rpx;
					box-sizing: border-box;
				}
			}

			.cart-class-gl {
				display: flex;
				color: white;
				width: 300rpx;
				height: 102rpx;
				justify-content: space-between;
				margin: 0 auto;
				margin-top: 55rpx;

				.cart-class-gl-pt {
					// width: 93rpx;
					height: 102rpx;
					display: flex;
					flex-direction: column;
					align-items: center;

					.num {
						font-size: 36rpx;
						// font-family: PingFang SC-Medium, PingFang SC;
						font-weight: 500;
						color: #FFFFFF;
						line-height: 42rpx;
					}

					.text {
						font-size: 26rpx;
						// font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #EFEFEF;
						line-height: 30rpx;
						margin-top: 10rpx;
					}
				}
			}
		}

		.share-shop {
			width: 690rpx;
			height: 176rpx;
			margin: 0 auto;
			margin-top: 30rpx;
			display: flex;
			justify-content: space-between;

			.box {
				width: 323rpx;
				height: 176rpx;
				position: relative;

				.vip-img {
					width: 323rpx;
					height: 176rpx;
				}

				.go-img {
					position: absolute;
					width: 122rpx;
					height: 42rpx;
					top: 110rpx;
					left: 20rpx;
				}
			}
		}

		.ucenter-tool {
			margin-left: 30rpx;
			margin-top: 30rpx;
			width: 690rpx;
			height: 753rpx;
			background: #FFFFFF;
			box-shadow: 2rpx 2rpx 9rpx 0rpx #CEDAE3;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			opacity: 1;
			padding: 30rpx;
			box-sizing: border-box;

			.ucenter-tooltitle {
				.ucenter-tooltitle-img {
					width: 133rpx;
					height: 37rpx;
				}
			}

			.toollist {
				.toollist-item {
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-top: 45rpx;

					.toollist-item-img {
						width: 64rpx;
						height: 64rpx;
					}

					.toollist-item-text {
						font-size: 32rpx;
						// font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #333333;
						line-height: 38rpx;
						margin-left: 30rpx;
						text-align: left;
						flex: 1;

					}

					.toollist-item-imgright {
						width: 14rpx;
						height: 24rpx;
						// margin-left: 390rpx;
					}
				}
			}
		}

		.xieyi {
			width: 100%;
			height: 100rpx;
			font-size: 24rpx;
			// font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #72ACE2;
			line-height: 28rpx;
			text-align: center;
			line-height: 100rpx;

			.shu {
				width: 1rpx;
				height: 20rpx;
				opacity: 1;
				border: 0.5rpx solid #72ACE2;
				margin: 0 20rpx;
			}
		}
	}

	//弹出框结束
</style>